#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
const int N = 1e5 + 9;
int n1, n2, m, u, v, ans;
int match[N], vis[N];
vector<int> edge[N];
void add(int a, int b)
{
    edge[a].push_back(b);
    edge[b].push_back(a);
}
bool dfs(int u)
{
    vis[u] = 1;
    for(int i=0; i<edge[u].size(); i++)
    {
        int v = edge[u][i];
        int w = match[v];
        if(w < 0 || !vis[w] && dfs(w))
        {
            match[v] = u;
            match[u] = v;
            return true;
        }
    }
    return false;
}
int main()
{
    cin >> n1 >> n2 >> m;
    for(int i=1; i<=m; i++)
    {
        cin >> u >> v;
        v += n1;
        add(u,v);
        add(v,u);
    }
    memset(match,-1, sizeof(match));
    for(int i=1; i<=n1; i++)
    {
        memset(vis,0,sizeof(vis));
        if(dfs(i)) ans++;
    }
    cout << ans << endl;
    return 0;
}
